<?php
namespace queue;
use think\Cache;

class Queue{
    private $redis=null;
    private $key="";
    function __construct($key)
    {
        $key="eshop_queue_$key";
        $cache = Cache::init();
        $this->redis= $cache->handler();
    }

    public function push($val){
        $this->redis->lpush($this->key, $val);
    }
    public function pull(){

    }
    public function getlists(){
        $lists=$this->redis -> lRange($this->key,0,10);
        return $lists;
    }
    public function pop(){
        $key=$this->redis -> rPop($this->key);
        return $key;
    }
}